﻿
/*----------------------------------------------------------------//
// 文件名：MoEquip.cs
// 文件功能描述：实体 MoEquip.
// 
// 创建标识：2009-02-27
//
// 修改标识：
// 修改描述：
//----------------------------------------------------------------*/
#region MoEquip
using System;
using System.Data;
using System.Globalization;
using System.Text;
using System.Xml;
using System.Data.Common;
namespace EQT.Model
{
	/// <summary>
	/// 业务实体MoEquip
	/// </summary>
	public partial class MoEquip:ICloneable
	{
		#region 表Equip的字段
		private string _equip_id;
		private string _equip_name;
		private string _oem;
		private DateTime _ex_fact_date;
		private string _nameplate;
		private DateTime _buy_date;
		private decimal _useful_life;
		private int _maintain_day_cyc;
		private string _equip_configs;
		#endregion
		
		#region 构造函数
		public MoEquip()
		{
		    
		    
		    
		    _ex_fact_date= DateTime.Now;
		    
		    _buy_date= DateTime.Now;
		    
		    
		    
		}
		#endregion
		
		#region 拷贝构造函数

		public MoEquip(MoEquip item)
		{
			item.CopyTo(this);
		}
		#endregion
		
		#region 带参数构造函数
	    public MoEquip(string equip_id,string equip_name,string oem,DateTime ex_fact_date,string nameplate,DateTime buy_date,decimal useful_life,int maintain_day_cyc,string equip_configs)
		{
		this._equip_id=equip_id;
		this._equip_name=equip_name;
		this._oem=oem;
		this._ex_fact_date=ex_fact_date;
		this._nameplate=nameplate;
		this._buy_date=buy_date;
		this._useful_life=useful_life;
		this._maintain_day_cyc=maintain_day_cyc;
		this._equip_configs=equip_configs;
		}
		#endregion
		
		#region 表Equip的字段属性
		/// <summary>
		/// EQUIP_ID
		/// </summary>
		public string Equip_Id
		{
			get {return _equip_id;}
			set {_equip_id=value;}
		}
		/// <summary>
		/// EQUIP_NAME
		/// </summary>
		public string Equip_Name
		{
			get {return _equip_name;}
			set {_equip_name=value;}
		}
		/// <summary>
		/// OEM
		/// </summary>
		public string Oem
		{
			get {return _oem;}
			set {_oem=value;}
		}
		/// <summary>
		/// EX_FACT_DATE
		/// </summary>
		public DateTime Ex_Fact_Date
		{
			get {return _ex_fact_date;}
			set {_ex_fact_date=value;}
		}
		/// <summary>
		///使用URL，引用外部文件。例如：/EQTWEBAPP/NAMEPLACE/EQUIP0003.JPG
		/// </summary>
		public string Nameplate
		{
			get {return _nameplate;}
			set {_nameplate=value;}
		}
		/// <summary>
		/// BUY_DATE
		/// </summary>
		public DateTime Buy_Date
		{
			get {return _buy_date;}
			set {_buy_date=value;}
		}
		/// <summary>
		/// USEFUL_LIFE
		/// </summary>
		public decimal Useful_Life
		{
			get {return _useful_life;}
			set {_useful_life=value;}
		}
		/// <summary>
		/// MAINTAIN_DAY_CYC
		/// </summary>
		public int Maintain_Day_Cyc
		{
			get {return _maintain_day_cyc;}
			set {_maintain_day_cyc=value;}
		}
		/// <summary>
		/// EQUIP_CONFIGS
		/// </summary>
		public string Equip_Configs
		{
			get {return _equip_configs;}
			set {_equip_configs=value;}
		}
		#endregion
		
		#region 辅助函数
		/// <summary>
		/// 拷贝函数
		/// </summary>
		public MoEquip CopyTo(MoEquip item)
        {
		    item.Equip_Id=this.Equip_Id;
		    item.Equip_Name=this.Equip_Name;
		    item.Oem=this.Oem;
		    item.Ex_Fact_Date=this.Ex_Fact_Date;
		    item.Nameplate=this.Nameplate;
		    item.Buy_Date=this.Buy_Date;
		    item.Useful_Life=this.Useful_Life;
		    item.Maintain_Day_Cyc=this.Maintain_Day_Cyc;
		    item.Equip_Configs=this.Equip_Configs;
			return item;
        }
		/// <summary>
		/// 克隆函数
		/// </summary>		
		public object Clone()
        {
            MoEquip NewEquip=new MoEquip();
		    NewEquip._equip_id=this._equip_id;
		    NewEquip._equip_name=this._equip_name;
		    NewEquip._oem=this._oem;
		    NewEquip._ex_fact_date=this._ex_fact_date;
		    NewEquip._nameplate=this._nameplate;
		    NewEquip._buy_date=this._buy_date;
		    NewEquip._useful_life=this._useful_life;
		    NewEquip._maintain_day_cyc=this._maintain_day_cyc;
		    NewEquip._equip_configs=this._equip_configs;
			return NewEquip;
		}
		
		private static MoEquip _empty = new MoEquip(string.Empty,string.Empty,string.Empty,DateTime.MinValue,string.Empty,DateTime.MinValue,0,-1,string.Empty);
        public static MoEquip Empty
        {
            get
            {
                return _empty;
            }
        }
		
		///<summary>
		///判断对象是否相等
		///<summary>
		public override bool Equals(object obj)
        {
            if (base.Equals(obj))
            {
                return true;
            }
            else
            {
                MoEquip NewEquip = obj as MoEquip;
                if (NewEquip == null)
                {
                    return false;
                }
                else
                {
				if (NewEquip.Equip_Id==this.Equip_Id && NewEquip.Equip_Name==this.Equip_Name && NewEquip.Oem==this.Oem && NewEquip.Ex_Fact_Date==this.Ex_Fact_Date && NewEquip.Nameplate==this.Nameplate && NewEquip.Buy_Date==this.Buy_Date && NewEquip.Useful_Life==this.Useful_Life && NewEquip.Maintain_Day_Cyc==this.Maintain_Day_Cyc && NewEquip.Equip_Configs==this.Equip_Configs)		
					{
                        return true; 
                    }
                }

            }
            return false;
            
        }
		///TODO:you should modify GetHashCode by yourself.
		public override int GetHashCode()
		{
			return base.GetHashCode();
		} 

		public override string ToString()
        {
		   return String.Format("Equip_Id={0}/Equip_Name={1}/Oem={2}/Ex_Fact_Date={3}/Nameplate={4}/Buy_Date={5}/Useful_Life={6}/Maintain_Day_Cyc={7}/Equip_Configs={8}",_equip_id,_equip_name,_oem,_ex_fact_date,_nameplate,_buy_date,_useful_life,_maintain_day_cyc,_equip_configs);
		 
		}
		#endregion
		
		#region DataTable Help Function
		///<summary>
		///DataRow转换成Model
		///</summary>
		public void Row2Model(DataRow row)
		{
		    if(row["Equip_ID"]!=null && row["Equip_ID"]!=DBNull.Value)
			{
			    this.Equip_Id = (string)row["Equip_ID"];
			}
			else
			{
				this.Equip_Id =string.Empty;
			}
		    if(row["Equip_Name"]!=null && row["Equip_Name"]!=DBNull.Value)
			{
			    this.Equip_Name = (string)row["Equip_Name"];
			}
			else
			{
				this.Equip_Name =string.Empty;
			}
		    if(row["OEM"]!=null && row["OEM"]!=DBNull.Value)
			{
			    this.Oem = (string)row["OEM"];
			}
			else
			{
				this.Oem =string.Empty;
			}
		    if(row["Ex_Fact_Date"]!=null && row["Ex_Fact_Date"]!=DBNull.Value)
			{
			    this.Ex_Fact_Date = (DateTime)row["Ex_Fact_Date"];
			}
			else
			{
				this.Ex_Fact_Date =DateTime.MinValue;
			}
		    if(row["Nameplate"]!=null && row["Nameplate"]!=DBNull.Value)
			{
			    this.Nameplate = (string)row["Nameplate"];
			}
			else
			{
				this.Nameplate =string.Empty;
			}
		    if(row["Buy_Date"]!=null && row["Buy_Date"]!=DBNull.Value)
			{
			    this.Buy_Date = (DateTime)row["Buy_Date"];
			}
			else
			{
				this.Buy_Date =DateTime.MinValue;
			}
		    if(row["Useful_Life"]!=null && row["Useful_Life"]!=DBNull.Value)
			{
			    this.Useful_Life = (decimal)row["Useful_Life"];
			}
			else
			{
				this.Useful_Life =0;
			}
		    if(row["Maintain_Day_Cyc"]!=null && row["Maintain_Day_Cyc"]!=DBNull.Value)
			{
			    this.Maintain_Day_Cyc = (int)row["Maintain_Day_Cyc"];
			}
			else
			{
				this.Maintain_Day_Cyc =-1;
			}
		    if(row["Equip_Configs"]!=null && row["Equip_Configs"]!=DBNull.Value)
			{
			    this.Equip_Configs = (string)row["Equip_Configs"];
			}
			else
			{
				this.Equip_Configs =string.Empty;
			}
		}
		
		///<summary>
		///Model转换成DataRow
		///</summary>
	　　public void Model2Row(DataRow row)
		{
			row["Equip_ID"] = this.Equip_Id;
			row["Equip_Name"] = this.Equip_Name;
			row["OEM"] = this.Oem;
			row["Ex_Fact_Date"] = this.Ex_Fact_Date;
			row["Nameplate"] = this.Nameplate;
			row["Buy_Date"] = this.Buy_Date;
			row["Useful_Life"] = this.Useful_Life;
			row["Maintain_Day_Cyc"] = this.Maintain_Day_Cyc;
			row["Equip_Configs"] = this.Equip_Configs;
		}
		#endregion
	}
}
#endregion
